precision mediump float;
varying vec2 v_uv;
varying vec3 v_tangentW;
varying vec3 v_bitangentW;
varying vec3 v_normalW;
uniform sampler2D teapot;
uniform sampler2D u_NormalMap;
void main()
{
	vec3 LightDirection=vec3(-1.0,-1.0,-1.0);
    vec3 normal = texture2D(u_NormalMap,v_uv).xyz;
    mat3 TBN = mat3(normalize(v_tangentW),normalize(v_bitangentW),normalize(v_normalW));
    vec3 normalW = normalize((TBN * (2.0 * normal - 1.0)).xyz);
    float diffuse = max(0.5, dot(-LightDirection,normalW));
    vec4 color = texture2D(teapot,v_uv);
    gl_FragColor = vec4(diffuse * color.xyz,color.a);
}
